package com.itcast.ixun.activity;

import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.RadioButton;

import com.itcast.ixun.R;
import com.itcast.ixun.fragment.HomeFragment;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {
    private FragmentManager manager;
    private FragmentTransaction transaction;
    private RadioButton rb_home, rb_find, rb_live, rb_me;

    @Override
    protected void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        initData();
    }

    private void initView() {
        rb_home = (RadioButton) findViewById(R.id.rb_home);
        rb_find = (RadioButton) findViewById(R.id.rb_find);
        rb_live = (RadioButton) findViewById(R.id.rb_live);
        rb_me = (RadioButton) findViewById(R.id.rb_me);
        rb_home.setOnClickListener(this);
        rb_find.setOnClickListener(this);
        rb_live.setOnClickListener(this);
        rb_me.setOnClickListener(this);
    }

    private void initData() {
        manager = getSupportFragmentManager();
        transaction = manager.beginTransaction();
        transaction.replace(R.id.content_main, new HomeFragment());
        transaction.commit();
    }

    @Override
    public void onClick(View v) {

    }
}
